<template>
  <div class="navbar">
    <div class="logo">
      <font-awesome-icon :icon="['fas', 'car-side']" />
      QQ飞车图鉴
    </div>
    <div class="nav-links">
      <router-link to="/"><font-awesome-icon :icon="['fas', 'home']" /> 首页</router-link>
      <router-link to="/car-list"><font-awesome-icon :icon="['fas', 'car']" /> 赛车图鉴</router-link>
      <router-link to="/pet-list"><font-awesome-icon :icon="['fas', 'paw']" /> 宠物图鉴</router-link>
      <router-link to="/compare"><font-awesome-icon :icon="['fas', 'balance-scale']" /> 比较工具</router-link>
      <a href="#"><font-awesome-icon :icon="['far', 'comment-dots']" /> 社区</a>
    </div>
    <div class="user-actions">
      <div class="search-box">
        <font-awesome-icon :icon="['fas', 'search']" />
        <input type="text" placeholder="搜索赛车、宠物...">
      </div>
      <router-link to="/user-profile" style="color: white;"><font-awesome-icon :icon="['far', 'user']" /></router-link>
    </div>
  </div>
</template>

<script setup>
/**
 * 导航栏组件
 * @component Navbar
 */
</script>

<style scoped>
.navbar {
  background: linear-gradient(135deg, #3a8bff 0%, #0052cc 100%);
  padding: 15px 30px;
  color: white;
  border-radius: 10px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 22px;
  font-weight: bold;
  display: flex;
  align-items: center;
}

.logo i {
  margin-right: 10px;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-links a {
  color: white;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 5px;
  transition: background 0.3s;
}

.nav-links a:hover,
.nav-links a.router-link-active {
  background: rgba(255, 255, 255, 0.2);
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  position: relative;
}

.search-box input {
  padding: 8px 15px;
  padding-left: 35px;
  border-radius: 20px;
  border: none;
  width: 250px;
}

.search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
}

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    padding: 15px;
  }
  
  .nav-links {
    margin: 15px 0;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 10px;
  }
  
  .user-actions {
    width: 100%;
    justify-content: space-between;
  }
  
  .search-box input {
    width: 100%;
  }
}
</style> 